class Story < ActiveRecord::Base
  
  belongs_to :story_state
  has_one :created_by_user, :class_name => "User", :foreign_key => "id", :primary_key => "created_by_user_id", :readonly => true
  has_one :claimed_by_user, :class_name => "User", :foreign_key => "id", :primary_key => "claimed_by_user_id", :readonly => true
  
  validates_presence_of :title
  validates_presence_of :as_a
  validates_presence_of :i_want
  validates_presence_of :so_that
  
  def self.all_active
    
    Story.find(:all, :joins => :story_state, :conditions => ["story_states.active", true]);
    
  end
  
end